<template>
    <div>
        <transition name="fade">
            <div id="search" v-if="search_show">
                <el-form
                        :label-position="labelPosition"
                        label-width="90px"
                        :inline="true"
                >
                    <el-form-item label="省份" v-show="!searchForm.province_status">
                        <el-select
                                placeholder="请选择省份"
                                v-model="searchForm.province_id"
                                @change="regionCitys()"
                                :disabled="searchForm.province_status"
                                clearable
                        >
                            <el-option
                                    :key="item.id"
                                    :label="item.district"
                                    :value="item.id"
                                    v-for="item in province_list"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="城市" v-show="!searchForm.city_status">
                        <el-select
                                placeholder="请选择城市"
                                v-model="searchForm.city_id"
                                @change="regionCounty()"
                                :disabled="searchForm.city_status"
                                clearable
                        >
                            <el-option
                                    :key="item.id"
                                    :label="item.district"
                                    :value="item.id"
                                    v-for="item in city_list"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="区县" v-show="!searchForm.district_status">
                        <el-select
                                placeholder="请选择区县"
                                v-model="searchForm.district_id"
                                @change="institutionAllApi()"
                                clearable
                        >
                            <el-option
                                    :key="item.id"
                                    :label="item.district"
                                    :value="item.id"
                                    v-for="item in district_list"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item
                            label="机构名称"
                            v-show="!searchForm.institution_status"
                    >
                        <el-select
                                placeholder="请选择机构"
                                v-model="searchForm.institution_id"
                                filterable
                                clearable
                        >
                            <el-option
                                    :key="item.id"
                                    :label="item.gmc"
                                    :value="item.id"
                                    v-for="item in institution_list"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>


                    <el-form-item label="姓名">
                        <el-input
                                v-model="searchForm.name"
                                placeholder="请输入姓名"
                                clearable
                        ></el-input>
                    </el-form-item>

                    <el-form-item label="性别">
                        <el-select
                                placeholder="请选择性别"
                                v-model="searchForm.sex"
                                clearable
                        >
                            <el-option
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.name"
                                    v-for="item in sex_list"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="年龄">
                        <el-input
                                v-model="searchForm.age"
                                placeholder="请输入年龄"
                                clearable
                        ></el-input>
                    </el-form-item>

                    <el-form-item label="身份证">
                        <el-input
                                v-model="searchForm.sfz"
                                placeholder="请输入身份证"
                                clearable
                        ></el-input>
                    </el-form-item>

                    <el-form-item label="内镜报告单">
                        <el-select
                                placeholder="请选择"
                                v-model="searchForm.is_sample"
                                clearable
                        >
                            <el-option
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.value"
                                    v-for="item in is_upload_list"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="病理报告单">
                        <el-select
                                placeholder="请选择"
                                v-model="searchForm.is_image"
                                clearable
                        >
                            <el-option
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.value"
                                    v-for="item in is_upload_list"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否合格">
                        <el-select
                                placeholder="请选择"
                                v-model="searchForm.approve"
                                clearable
                        >
                            <el-option
                                    :key="item.value"
                                    :label="item.name"
                                    :value="item.value"
                                    v-for="item in approve_list"
                            >
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="病理报告日期">
                        <el-date-picker
                                clearable
                                format="yyyy-MM-dd"
                                placeholder="选择病理报告日期"
                                type="date"
                                style="width: 94%"
                                v-model="searchForm.blbg_time"
                                value-format="yyyy-MM-dd "
                        ></el-date-picker>
                    </el-form-item>

                    <el-form-item label="内镜诊断医师">
                        <el-input
                                v-model="searchForm.nj_staff"
                                placeholder="请输入内镜诊断医师"
                                clearable
                        ></el-input>
                    </el-form-item>

                    <el-form-item label="内镜诊疗">
                        <el-date-picker
                                v-model="searchForm.blsy_time"
                                type="daterange"
                                format="yyyy-MM-dd"
                                value-format="yyyy-MM-dd"
                                range-separator="至"
                                start-placeholder="开始日期"
                                end-placeholder="结束日期"
                                align="right"
                        >
                        </el-date-picker>
                    </el-form-item>

                    <el-form-item label="创建数据">
                        <el-date-picker
                                v-model="searchForm.created_at"
                                type="daterange"
                                format="yyyy-MM-dd "
                                value-format="yyyy-MM-dd"
                                range-separator="至"
                                start-placeholder="开始日期"
                                end-placeholder="结束日期"
                                align="right"
                        >
                        </el-date-picker>
                    </el-form-item>

                    <el-form-item label="">

                        <el-button
                                @click="submitForm()"
                                icon="el-icon-search"
                                type="primary"
                        >查询
                        </el-button
                        >


                        <PersButton
                                @click="handleClickExport()"
                                label="导出"
                                type="primary"
                                size=""
                                perms="muster:dataDetails:button:export"
                        ></PersButton>
                        <el-button @click="handleReset()">重置</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </transition>
        <div class="block-control">
            <div class="block-back" @click="setSearchShow">
                <i :class="search_show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props: ['categoryData'],
        components: {},
        data() {
            return {
                //查询条件
                searchForm: {
                    name: "",
                    phone: "",
                },
            }
        },
        created() {
        },
        methods: {

            //父页面的回调事件
            handleParentEvent() {
                this.$emit('setSearchForm', this.searchForm)
            },
            //创建
            handleSearch() {
                this.handleParentEvent()
            },
            handleReset() {
                this.searchForm = {
                    category_id: "",
                    title: "",
                };
                this.handleParentEvent()
            },
        }
    }
</script>

<style scoped>

</style>
